﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板

namespace XiaoweiUWP.HpControls
{
    public sealed partial class SliderBar : UserControl
    {
        public SliderBar()
        {
            this.InitializeComponent();
            this.Loaded += SliderBar_Loaded;
        }

        private void SliderBar_Loaded(object sender, RoutedEventArgs e)
        {
            
            this.SkillBtn.SetSelected();
            this.PreBtn = SkillBtn;
        }

        public event Action SkillClick;
        public event Action MettingClick;
        public event Action InputClick;
        public event Action SougouClick;
        public event Action SubtitleClick;
        private HpStatesBtn PreBtn;


        private void SubtitleBtn_Click()
        {
            if(PreBtn==this.SubtitleBtn)
            {
                return;
            }

            this.PreBtn.SetUnSelected();
            SubtitleClick?.Invoke();
            this.PreBtn = SubtitleBtn;
        }

        private void InputBtn_Click()
        {
            if (PreBtn == this.InputBtn)
            {
                return;
            }
            this.PreBtn.SetUnSelected();
            InputClick?.Invoke();
            this.PreBtn = InputBtn;
        }

        private void MettingBtn_Click()
        {
            if (PreBtn == this.MettingBtn)
            {
                return;
            }
            this.PreBtn.SetUnSelected();
            MettingClick?.Invoke();
            this.PreBtn = MettingBtn;
        }

        private void SougouBtn_Click()
        {
            if (PreBtn == this.SougouBtn)
            {
                return;
            }
            this.PreBtn.SetUnSelected();
            SougouClick?.Invoke();
            this.PreBtn = SougouBtn;
        }

        private void SkillBtn_Click()
        {
            if (PreBtn == this.SkillBtn)
            {
                return;
            }
            this.PreBtn.SetUnSelected();
            SkillClick?.Invoke();
            this.PreBtn = SkillBtn;
        }

    }
}
